#include "lua_Input.h"

namespace Lua
{
	LUA_FUNCTION(_inputGetMousePos)
	{
		Herz::InputHandle *ih = Herz::InputHandle::create();
		lua_pushinteger(L, static_cast<int>(ih->getMouseX()));
		lua_pushinteger(L, static_cast<int>(ih->getMouseY()));
		return 2;
	}

	LUA_FUNCTION(_inputIsKeyPress)
	{
		luaL_checktype(L, 1, LUA_TNUMBER);
		Herz::InputHandle *ih = Herz::InputHandle::create();
		if (ih->isKey(luaL_checkinteger(L, 1)))
			lua_pushboolean(L, (bool)true);
		else
			lua_pushboolean(L, (bool)false);
		return 1;
	}
} // namespace Lua